package com.xue566.util;

import com.xue566.enums.StateEnum;

/**
 * @Author: Wuzh
 * @Description:
 * @Date Created in 21:44 2020/8/5
 * @return
 */
public class StateException extends RuntimeException {


    /**
     * 状态码
     */
    private String code;

    private String detailMessage;

    public String getCode () {
        return code;
    }

    public void setCode (String code) {
        this.code = code;
    }


    public StateException (StateEnum stateEnum) {
        super(stateEnum.getMessage());
        this.code = stateEnum.getCode();
        this.detailMessage = stateEnum.getMessage();
    }

    public StateException (String code, String message) {
        super(message);
        this.code = code;
        this.detailMessage = message;
    }


    public StateException (StateEnum stateEnum, String detailMessage) {
        super('[' + stateEnum.getCode() + ']' + " => " + detailMessage);
        this.code = stateEnum.getCode();
        this.detailMessage = detailMessage;
    }


}
